package com.ssm.juc.volatile100;

public class VolatileTest {
    static volatile boolean initFlag = false;

    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            while (!initFlag) {
            }
            System.out.println("----> initFlag = " + initFlag);
        }).start();

        Thread.sleep(200);
        initFlag = true;
        Thread.sleep(2000);
        System.out.println("----> over initFlag = " + initFlag);
    }
}
